﻿#include <iostream>
using namespace std;


class Solution
{
    int memo[201][201];
public:
    // 375. 猜数字大小 II
    int getMoneyAmount(int n)
    {
        return dfs(0, n);
    }

    int dfs(int left, int right)
    {
        if (left >= right)
            return 0;
        if (memo[left][right] != 0)
            return memo[left][right];

        int ret = INT_MAX;
        for (int head = left; head <= right; head++)
        {
            int x = dfs(left, head - 1);
            int y = dfs(head + 1, right);
            ret = min(ret, head + max(x, y));
        }
        memo[left][right] = ret;
        return ret;
    }
};

int main()
{

    return 0;
}